package com.njxxted.activiti.modules.process.extend.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.activiti.engine.runtime.ProcessInstance;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;


/**
 * 描述：工作流扩展表-流程实例表 Entity
 * <p>
 * 作者：HuTongFu
 * 邮箱：hu_tongfu@163.com
 * 时间：2019-08-10 17:14:48
 */
@Data
public class ExtendActInstanceEntity implements Serializable {

    private static final long serialVersionUID = -6009766590145859674L;
    //主键id
    private String id;
    //流程实例id
    private String instanceId;
    //流程定义id
    private String processDefId;
    //流程部署id
    private String deploymentId;
    //流程key
    private String processKey;
    //流程业务id
    private String businessId;
    //流程发起人id
    private String startUserId;
    //流程发起人
    private String startUserName;
    //流程名称
    private String name;
    //当前节点名称
    private String currNodeName;
    //当前节点定义key
    private String currNodeDefKey;
    //当前节点id
    private String currNodeId;
    //上一节点id
    private String preNodeId;
    //截止日期
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date deadline;
    //最近办理时间
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date recentlyDoTime;
    //流程状态
    private String status;
    //流程第一个用户任务节点（非开始节点）
    private String startNodeKey;
    //流程完成时间
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date finishedTime;
    //流程结束人Id
    private String finishedUserId;
    //流程作废人
    private String deletedUserId;
    //作废时间
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date deletedTime;

    //添加时间
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date addDate;
    //是否已读
    private String isView;

    public ExtendActInstanceEntity(ProcessInstance processInstance) {
        this.name = processInstance.getName();
        this.instanceId = processInstance.getProcessInstanceId();
        this.processDefId = processInstance.getProcessDefinitionId();
        this.deploymentId = processInstance.getDeploymentId();
        this.processKey = processInstance.getProcessDefinitionKey();
        this.businessId = processInstance.getBusinessKey();
    }

    public ExtendActInstanceEntity() {
    }
}
